<?php 
include "class.phpmailer.php";  
include "class.smtp.php";  

$mail = new PHPMailer(); 
$mail->IsSMTP(); // set mailer to use SMTP 
$mail->Host = "smtp.gmail.com"; // specify main and backup server 
$mail->Port = 465; // set the port to use 
$mail->SMTPAuth = true; // turn on SMTP authentication 
$mail->SMTPSecure = 'ssl'; 
$mail->Username = "khuyenhoc.lienhe@gmail.com"; // your SMTP username or your gmail username 
$mail->Password = "khuyenhoc123"; // your SMTP password or your gmail password 
$from = "khuyenhoc.lienhe@gmail.com"; // Reply to this email 
$mail->From = $from; 
$mail->FromName = $name; // Name to indicate where the email came from when the recepient received 
$mail->AddAddress($email_nhan,$name); 
$mail->AddReplyTo($from,$name); 
$mail->WordWrap = 50; // set word wrap 
$mail->IsHTML(true); // send as HTML 
$mail->Subject = $title;
$mail->Body = "<p style='line-height:25px'><strong>Thông tin đăng ký nhận ưu đãi:</strong><br />
Công ty: <strong>{$congty}</strong><br />
Họ tên: <strong>{$hoten}</strong><br />
Điện thoại: <strong>{$dienthoai}</strong><br />
Email: <strong>{$email}</strong><br /></p>
";
$mail->AltBody =''; //Text Body 
//$mail->SMTPDebug = 2; 
$mail->SetFrom($tmp, 'Test Mail'); 
$mail->CharSet = "UTF-8"; 
if(!$mail->Send()) echo "<h1>Loi khi goi mail: " . $mail->ErrorInfo . '</h1>'; else echo "1";